package com.smarttest.portal.controller;


import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.smarttest.common.beans.GeneralResultWithStatus;
import com.smarttest.portal.service.ZentaoService;

@Controller
public class ZentaoController {

	@Autowired
	ZentaoService zentaoService;
	@RequestMapping(value = "/getBUG.action", method = {RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public GeneralResultWithStatus getBUG (Integer productId) {
		return GeneralResultWithStatus.okData(null, zentaoService.queryBUGToday(productId));
	}
	@RequestMapping(value = "/getProducts.action", method = {RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public GeneralResultWithStatus getProducts (HttpServletRequest request) {
		return GeneralResultWithStatus.okData(null, zentaoService.getProducts());
	}
	@RequestMapping(value = "/updateNow.action", method = {RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public GeneralResultWithStatus updateNow (HttpServletRequest request) {
		return GeneralResultWithStatus.okData(null, zentaoService.updateBugTolocalNow());
	}
}
